begin
create table INCIDENTS
(
  processname    NCHAR(256) not null,
  processversion NUMBER(20),
  incident       NUMBER(20) not null,
  priority       NUMBER(20),
  summary        NCHAR(512),
  starttime      DATE,
  endtime        DATE,
  status         NUMBER(20),
  initiator      NCHAR(512),
  parenttaskid   CHAR(64),
  timelimit      DATE,
  helpurl        NCHAR(512),
  mainss         BLOB
)
create index INCIDENTS01 on INCIDENTS (PROCESSNAME, PROCESSVERSION, INCIDENT, STATUS, TIMELIMIT)
  tablespace ULTIMUSDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
create index INCIDENTS02 on INCIDENTS (ENDTIME, STATUS, PROCESSNAME, INCIDENT)
  tablespace ULTIMUSDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
create index INCIDENTS03 on INCIDENTS (INCIDENT)
  tablespace ULTIMUSDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
create index INCIDENTS04 on INCIDENTS (STATUS)
  tablespace ULTIMUSDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table INCIDENTS
  add constraint INCCON primary key (PROCESSNAME, INCIDENT)
  using index 
  tablespace ULTIMUSDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );

create table TASKS
(
  taskid         CHAR(64) not null,
  processname    NCHAR(256),
  processversion NUMBER(20),
  incident       NUMBER(20),
  stepid         CHAR(64),
  steplabel      NCHAR(128),
  recipient      NCHAR(256),
  recipienttype  NUMBER(20),
  taskuser       NCHAR(512),
  assignedtouser NCHAR(512),
  status         NUMBER(20),
  substatus      NUMBER(20),
  starttime      DATE,
  endtime        DATE,
  qstarttime     DATE,
  qendtime       DATE,
  delaytime      DATE,
  overduetime    DATE,
  urgentduetime  DATE,
  taskrate       FLOAT(53),
  tasktime       NUMBER(20),
  cost           FLOAT(53),
  helpurl        NCHAR(512),
  notes          NCHAR(512),
  referer        CHAR(64),
  localss        BLOB
)

create index TASKS01 on TASKS (PROCESSNAME, PROCESSVERSION, INCIDENT, STEPID, TASKID)
  tablespace ULTIMUSDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
create index TASKS02 on TASKS (PROCESSNAME, INCIDENT, STEPID)
  tablespace ULTIMUSDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
create index TASKS03 on TASKS (STATUS, SUBSTATUS, REFERER)
  tablespace ULTIMUSDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
create index TASKS04 on TASKS (RECIPIENTTYPE, STATUS, SUBSTATUS, OVERDUETIME)
  tablespace ULTIMUSDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
create index TASKS05 on TASKS (INCIDENT)
  tablespace ULTIMUSDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table TASKS
  add constraint INCCON3 primary key (TASKID)
  using index 
  tablespace ULTIMUSDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
  end;